<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="./styles/general.css" rel="stylesheet" type="text/css" />
<link href="./styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../images/jquery.js"></script>
<style>
table tr td{ text-align:center;}
.testone{ background:red;}
</style>
<title></title>
<script type="text/javascript">
var had_show = show_id = 0;
function  change_image(version_id)
{
	if( had_show && show_id != version_id ){
		alert('已有其它版本在前台显示，请先取消其在前台显示！');
		return false;
	}
	
	var value = 0;
	if($('#version_'+version_id).attr("src") == './images/yes.gif')
	{
		if(window.confirm('确定取消该版本在网站上的显示？'))
		{
			value = 0;
			$('#version_'+version_id).attr("src","./images/no.gif"); 
			had_show = 0;
		}
		else
		{
			return false;
		}
	}
	else
	{
		 value = 1;
		 $('#version_'+version_id).attr("src","./images/yes.gif");
		 had_show = 1;
		 show_id = version_id;
	}
	$.post("./product.php?action=UpdataVersion",{version_id:version_id,value:value, product_id: $("#product_id").val()},function(data){
	});
}
function backgo()
{
	history.back(); 
}

function sync_version_cbs(p_cid,p_id)
{
	if(window.confirm('是否同步CBS版本信息？'))
	{
		location.href="./product.php?action=sync_version_cbs&product_cbsid="+p_cid+"&product_id="+p_id;
	}
	else
	{
		return false;
	}
}

//ntoe 重设软件大小
function resetSize( v_id ){
	$.get('./product.php?action=ajax_set_size&v_id='+v_id,function(data){
		$("#td_"+v_id).html( data );
	});
	$("#td_"+v_id).html( '正在获取...' );
}
</script>
</head>
<body>
<h1>

<span class="action-span1">
<a href="./product.php?action=productList">公共产品信息管理</a>&nbsp—&nbsp版本信息管理
</span><input style="float:right; margin-right:10px;" type="button" value="同步CBS版本信息" onclick="sync_version_cbs(<{$product.product_cbsid}>,<{$product.product_id}>);">
<div style="clear:both"></div>
</h1>

<h1>

<span class="action-span1">
&nbsp;&nbsp;产品名称：<{$product.product_name}> &nbsp;&nbsp;&nbsp; 产品编号：<{$product.product_sn}> 
</span>
<div style="clear:both"></div>
<input type="hidden" id="product_id" name="product_id"  value="<{$product_id}>"/>
</h1>

<form>
 <{if count($product_version)<=0}>
  <h2 style="text-align:center;">没有数据</h2>
  <{else}>
 <table width="100%" cellspacing="1" cellpadding="2" id="table_info" class="list-div">
    <tr>
      <th width="20%">版本号</th>
      <th>软件大小（单位M）</th>
      <th>What's new 内容</th>
      <th>是否在网站显示</th>
      <th>操作人</th>
      <th>操作时间</th>
    </tr>
    <{foreach from=$product_version key=myID item=version}>
	    <{if $product.sub_license_id == 0}>
		    <tr>
		      <td><{$version.version_name}></td>
		      <td id="td_<{$version.v_id}>"><{$version.product_size}> <{if $version.product_size == 0}>（<a href="javascript:resetSize(<{$version.v_id}>);">重新获取</a>）<{/if}></td>
		      <td><a href="./product.php?action=Version_new&product_id=<{$product.product_id}>&version_id=<{$version.v_id}>">查看</a></td>
		      <td><img id="version_<{$version.v_id}>" onclick="change_image(<{$version.v_id}>)" src="./images/<{if $version.is_sale == 1}>yes<{else}>no<{/if}>.gif" /></td>
		      <td><{$version.operater}></td>
		      <td><{$version.publish_date}></td>
		    </tr>
            
            <{if $version.is_sale == 1}><script type="text/javascript">had_show = 1;show_id = <{$version.v_id}>;</script><{/if}>
	    <{/if}>
    <{/foreach}>
    <tr>
    <td colspan="6"><{$page_url}> &nbsp;&nbsp;&nbsp; 共有 <span id="total"><{$total}></span>条记录&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="后退" id="goback" onclick="backgo();"></td>
    </tr>
  </table>
<{/if}>
</form>
</body>
</html>
